package com.puzzlebazar.client.user;

import java.util.HashMap;

import com.puzzlebazar.client.main.control.MainController;
import com.puzzlebazar.client.main.control.NamedStateController;
import com.puzzlebazar.client.main.control.StateWithSubstates;
import com.puzzlebazar.client.main.view.MainView;
import com.puzzlebazar.client.user.UserModel;

public class SettingsState extends StateWithSubstates {

	public static final String STATE_TOKEN = "Settings";
	public static final String TITLE = "User Settings";
	
	private final SettingsController settingsController;

	public SettingsState(UserModel userModel, MainView view, MainController controller) {
		super(userModel, view, controller);
		
		settingsController = new SettingsController( userModel, tabbedView, controller, subStateTokenFactory );
	
	}

	@Override
	public String getStateToken() {
		return STATE_TOKEN;
	}
	
	@Override
	protected String getMainPanelTitle() {
		return TITLE;
	}

	@Override
	protected NamedStateController getSubController() {
		return settingsController;
	}

	@Override
	protected void addCustomParams(HashMap<String, String> params) {		
	}	



	@Override
	public void enter() {
		super.enter();
		if( !userModel.isValid() )
			view.setNoLeftBarView();
	}

	@Override
	public void exit() {
		view.setStandardView();
	}

	@Override
	public void release() {
		super.release();
		settingsController.release();
	}

}
